<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  
<title>{{ get_app_inf key="siteName" }} - {{ $title }}</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />  
<!-- add your meta tags here -->  
  
<link href="css/my_layout.css" rel="stylesheet" type="text/css" />
<link href="css/screen/band.css" rel="stylesheet" type="text/css" />  
<!--[if lte IE 7]>  
<link href="css/my_patches/patch_my_layout.css" rel="stylesheet" type="text/css" />  
<![endif]-->  
<script type="text/javascript" src="script/jquery.js"><!-- jQuery 1.2.1 --></script>
<script type="text/javascript" src="script/jquery.form.js"><!-- 表单Ajax插件 --></script>
<script type="text/javascript" src="script/yav.js"><!-- 表单验证插件 --></script>
<script type="text/javascript" src="script/jquery.yav.pack.js"><!-- 表单验证插件 --></script>
<script type="text/javascript" src="script/jquery.confirm.js"><!-- 对话框插件 --></script>
<script type="text/javascript">


// 在网页载入时加载
$(function() {
	
	// 全部角色列表鼠标划过动作
	$("#allRoles li, #allPermissions li, input:submit").hover(function(){
		$(this).addClass("OMover");
	},function(){
		$(this).removeClass("OMover");
	});
	
	$("select[name^='is_include'], select[name^='is_allow']").click(function(){
		if($(this).val() == 1){
			$(this).addClass("green");
			$(this).removeClass("red");
		}else{
			$(this).addClass("red");
			$(this).removeClass("green");
		}
	});
		
	
	// 全部角色列表span开关式点击并触发checkbox点击动作
	$("#allRoles span").toggle(function(){
		// 选中复选框
		$("#allRoles li input[role_id='" + $(this).attr("role_id") + "']").attr("checked","on");
		// 为下拉框增加样式
		$(this).prev("select").click();
		// 选中整行
		$("#allRoles li[role_id='" + $(this).attr("role_id") + "']").addClass("Select");
		
	},function(){
		// 清除复选框
		$("#allRoles li input[role_id='" + $(this).attr("role_id") + "']").removeAttr("checked");
		// 恢复下拉框样式
		$(this).prev("select").removeAttr("class");
		// 取消选中整行
		$("#allRoles li[role_id='" + $(this).attr("role_id") + "']").removeClass("Select");
	});
	$("#allRoles input:checkbox").click(function(){
		$("#allRoles span[role_id='" + $(this).attr("role_id") + "']").click();
	});

	
	// 全部权限列表span开关式点击并触发checkbox点击动作
	$("#allPermissions span").toggle(function(){
		// 选中复选框
		$("#allPermissions li input[permission_id='" + $(this).attr("permission_id") + "']").attr("checked","on");
		// 为下拉框增加样式
		$("#allPermissions li[permission_id='" + $(this).attr("permission_id") + "'] select").click();
		// 为整行增加样式
		$("#allPermissions li[permission_id='" + $(this).attr("permission_id") + "']").addClass("Select");
	},function(){
		// 清除复选框
		$("#allPermissions li input[permission_id='" + $(this).attr("permission_id") + "']").removeAttr("checked");
		// 恢复下拉框样式
		$("#allPermissions li[permission_id='" + $(this).attr("permission_id") + "'] select").removeAttr("class");
		// 取消整行样式
		$("#allPermissions li[permission_id='" + $(this).attr("permission_id") + "']").removeClass("Select");
	});
	$("#allPermissions input:checkbox").click(function(){
		$("#allPermissions span[permission_id='" + $(this).attr("permission_id") + "']").click();
	});

	// 选中
	_selectself();
	
});

// 把角色和权限表单恢复原状
function _clearall(){
	$("#allRoles li[class='Select'] span").click();
	$("#allPermissions li[class='Select'] span").click();
	$("li[class!='Select'] select").removeAttr("class");
}

function _selectself(){
	// 选中自身已有的角色
	{{ foreach from=$thisuser.roles item=value }}
		$("#allRoles span[role_id='{{ $value.role_id }}']").click();
		$("#allRoles li[role_id='{{ $value.role_id }}'] select").val({{ $value.join_is_include }}).click();
	{{ /foreach }}
	
	// 选中自身已有的权限
	{{ foreach from=$thisuser.permissions item=value }}
		$("#allPermissions span[permission_id='{{ $value.permission_id }}']").click();
		$("#allPermissions li[permission_id='{{ $value.permission_id }}'] select").val({{ $value.join_is_allow }}).click();
	{{ /foreach }}
}

</script>


</head>  


<body> 
  <div id="page_margins">

    <div id="border-top">
      <div id="edge-tl"></div>
      <div id="edge-tr"></div>
    </div>
    <div id="page">
      {{ include file="admin/Websetup_header.html" }}
      {{ include file="admin/Websetup_nav.html" }}

      <div id="main">
        <div id="col1">
          <div id="col1_content" class="clearfix">
				{{ webcontrol type="menu" name="myMenu" }}
          </div>
        </div>
        <div id="col3">
          <div id="col3_content" class="clearfix">
            
				{{ include file = "admin/Websetup_userband_list.html" }}
            
          </div>
          <!-- IE Column Clearing -->
          <div id="ie_clearing"> &#160; </div>
        </div>
      </div>
      <!-- begin: #footer -->
      {{ include file="admin/Websetup_footer.html" }}
    </div>
    <div id="border-bottom">
      <div id="edge-bl"></div>
      <div id="edge-br"></div>
    </div>
  </div>
</body>
</html>
